Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
TypeScript Chrome extension "Duplicate function implementation."

I am currently working on a chrome extension with multiple content scripts using typescript (I'm new to both js and ts). Inside of the content scripts I have two functions with the same name. I basically need to know how to "allow" this:

//FileA:
function methodxyz(param: Element): void {

//FileB:
function methodxyz(param: Element): void {

I have read in other articles to either put export { }; on the top of my file or to put export in front of my functions. But then I get an error when using my extension that says: Uncaught SyntaxError: Unexpected token 'export' or something similar.

I think there is an option in typescript to combine all of your files into one .js file which I would assume causes that error to be thrown, but as I don't want that functionality I hope someone can help me with this :)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Typescript has Namespaces for that.

From reading the comments, just wanted to say something on JS & TS. I think an important thing to understand about javascript is that there are a lot of different runtimes going around (different browser versions, node versions, etc.), and they don't all support all the latest features of the language specification, which are defined in the ECMAScript Language Specification.

So as a developer, to be able to use the newest features of the language, while not worrying about being compatible with every runtime that is going to run my code, you can transpile your code into an older version to make it compatible. That brings the advantage that you can program with the newest, flashy things.

You can take a look at https://babeljs.io/

Once you do that, you can follow more JS standards instead of namespaces by writing your code as Modules, which is something supported natively in JS and TS. Read about modules in TS.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda